package travelDream.web.beans.prodotto.base;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import travelDream.ejb.prodotto.base.HotelDTO;
import travelDream.ejb.prodotto.base.ProdottoBase;

/**
 * Session Bean implementation class NuovoVoloBean
 */
@ManagedBean(name="HotelBean")
@ViewScoped
public class HotelBean {

	@EJB
	private ProdottoBase prodBase;

	private HotelDTO hotel;
	
    public HotelBean() {
        hotel = new HotelDTO();
    }
    
    public HotelDTO getHotel(){
    	return this.hotel;
    }
    
	public void setHotel(HotelDTO hotel) {
		this.hotel = hotel;
	}
	
	public void setHotelById(int id) {
		this.hotel = prodBase.getHotelDTOById(id);
	}
	
	public String nuovoHotel(){
		prodBase.nuovoHotel(hotel);
		return "/admin/home?faces-redirect=true";
	}
	
	public String modificaHotel(){
		prodBase.modificaHotel(hotel);
		return "/admin/home?faces-redirect=true";
	}
	
	public String cancellaHotel(){
		prodBase.cancellaHotel(hotel);
		return "/admin/home?faces-redirect=true";
	}

}